home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.12 Dec 89 / MacTutor App Code / MacTutorApp.h < prev    next >
Encoding:
Text File  |  1989-10-18  |  1.5 KB  |  50 lines  |  [TEXT/MPS ]

  1. // Class definitions.
  2.  
  3. // Our document class. Only displays some text in a window
  4. //
  5. class TMacTutorDocument : public TDocument {
  6.     
  7.   private:
  8.     short fItemSelected;
  9.     // string corresponding to menu item selected
  10.     StringPtr fDisplayString;
  11.  
  12.     void DrawWindow(void);
  13.  
  14.   public:
  15.     TMacTutorDocument(short resID, StringPtr s);
  16.     ~TMacTutorDocument(void);
  17.     // routine to access private variables
  18.     void SetDisplayString (StringPtr s) {fDisplayString = s;}
  19.     short GetItemSelected(void) {return fItemSelected;}
  20.     void SetItemSelected(short item) {fItemSelected = item;}
  21.  
  22.     // methods from TDocument we override
  23.     void DoUpdate(void);
  24. };
  25.  
  26. // TMacTutorApp is our application class. It is a subclass of TApplication,
  27. // so it only needs to specify its behaviour in areas where it is different
  28. // from the default.
  29. class TMacTutorApp : public TApplication {
  30. public:
  31.     TMacTutorApp(void);                // Our constructor
  32.  
  33. private:
  34.     // routines from TApplication we are overriding
  35.     long HeapNeeded(void);
  36.     unsigned long SleepVal(void);
  37.     void AdjustMenus(void);
  38.     void DoMenuCommand(short menuID, short menuItem);
  39.  
  40.     // routines for our own devious purposes
  41.     void DoNew(void);
  42.     void Terminate(void);
  43. };
  44.  
  45. // kMaxOpenDocuments is used to determine whether a new document can be opened
  46. // or created. We keep track of the number of open documents, and disable the
  47. // menu items that create a new document when the maximum is reached. If the
  48. // number of documents falls below the maximum, the items are enabled again. */
  49. const short    kMaxOpenDocuments = 1;
  50.